<%-- 
    Document   : index
    Created on : Apr 21, 2012, 7:01:58 PM
    Author     : TANGQUOCTUAN
--%>
<%@page import="entities.Customers"%>
<%@page import="java.util.List"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link href="JQuery/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="JQuery/jquery.min.js"></script>
<script src="JQuery/jquery-ui.min.js"></script>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tunga Restaurant</title>
        <link href="style_admin.css" rel="stylesheet" type="text/css" />
    </head>
    <script>
        $(function() {
            $( "#date1" ).datepicker();
            $( "#date2" ).datepicker();
        });
    </script>
    <script type="text/javascript">
        function check(){
            var start = document.getElementById("date1");
            var end = document.getElementById("date2");

            if(start.value.length==0){
                alert("Choose From day");
                return false;
            }

            if(end.value.length==0){
                alert("Choose End day");
                return false;
            }

            if(start.value>=end.value){
                alert("From day musf be bigger then to day");
                return false;
            }
            return true;
        }
    </script>
    <body>
        <c:set var="session" value="${sessionScope.user}"/>
        <c:if test="${empty session}">
            <c:redirect url="index.jsp"/>
        </c:if>
        <center>
            <div class="outer">
                <!--Header end-->
                <div id="rc1"></div>
                <div id="bg">
                    <div class="toplinks"><a href="ContactUs.jsp">Contact us</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="initShowFood?action=Food">Food</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="ControllerTables?action=Table">Table</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="ControllerRooms?action=Room">Room</a></div><div class="sap">|</div>
                    <c:if test="${empty session}">
                        <div class="toplinks"><a href="registration.jsp">Register</a></div><div class="sap">|</div>
                        <div class="toplinks"><a href="login.jsp">Login</a></div><div class="sap">|</div>
                    </c:if>
                    <div class="toplinks"><a href="index.jsp">Home Page</a></div>
                    <div><font color="white">Welcome, </font><font color="yellow">${sessionScope.user}</font> </div>
                    <div>
                        <font color="yellow"><a href="ControllerCustomer?action=Information&user=${sessionScope.user}">Your information</a></font>
                        <%
                                    if (session.getAttribute("isadmin") != null) {
                        %>
                        <a href="index_admin.jsp">Admin Manager</a>
                        <%                                    }
                        %>
                        <font color="yellow">
                            <c:url var="LogOut" value="ControllerCustomer">
                                <c:param name="action" value="LogOut"/>
                            </c:url>
                            <a href="${LogOut}">LogOut</a>
                        </font>
                    </div>
                </div>       
                <div id="rc2"></div>
                <div id="header">
                    <div class="name">Tunga Restaurant Admin Manager</div>
                    <div class="tag">The best restaurant in the world</div>
                </div>
                <!--Top nav end-->
                <div style="clear:left"></div>
                <div id="outer2">
                    <div id="left-nav">
                        <div class="leftlinks">
                            <span class="heading">Manage</span>
                            <ul>
                                <li><a href="ControllerCustomer?action=Customer">Customer</a></li>
                                <li><a href="ControllerFood?action=adminFood">Food</a></li>
                                <li><a href="ControllerAdminRooms?action=AdminRooms">Room</a></li>
                                <li><a href="ControllerTables?action=AdminTables">Table</a></li>
                                <li><a href="ControllerOrderFood?action=adminOrderFood">Order Food</a></li>
                                <li><a href="ControllerAdminBookRooms?action=AdminBookRooms">Book Room</a></li>
                                <li><a href="ControllerTables?action=AdminBookTables">Book Table</a></li>
                                <li><a href="report.jsp">Report</a></li>
                            </ul>
                        </div>
                    </div><div class="inner_copy"><div class="inner_copy">All <a href="http://www.magentothemesworld.com" title="Best Magento Templates">premium Magento themes</a> at Magentothemesworld.com!</div></div>
                    <div id="content" align="center">
                        <span class="heading">Report </span>
                        <div id="main">
                            <form action="ControllerCustomer" method="POST">
                                <h3 style="color: #7A0402">Customer Report</h3>
                                Search By Name <input type="text" name="name" value="" /> <input type="submit" name="action" value="SearchByUser"/>
                            </form>
                            <br>                            
                            <div align="center">
                                <c:set var="list" value="${requestScope.info}"/>
                                <c:set var="count" value="0"/>
                                <c:if test="${empty list}">
                                    No result!!!!!!!
                                </c:if>
                                <c:if test="${not empty list}">
                                    <table align="center" border="0" class="fixtable">
                                        <th>No</th>
                                        <th>UserName</th>
                                        <th>First Name</th>
                                        <th>Last Name</th>
                                        <th>Address</th>
                                        <c:forEach var="rows" items="${list}">
                                            <form action="report_customers.jsp" method="POST" target="_blank">
                                                <c:set var="count" value="${count+1}"/>
                                                <tr>
                                                    <td>${count}</td>
                                                    <td><input type="hidden" name="id" value="${rows.custID}"/>${rows.custID}</td>
                                                    <td>${rows.fname}</td>
                                                    <td>${rows.lname}</td>
                                                    <td>${rows.address}</td>
                                                    <td>                                                        
                                                        <input type="submit" name="action" value="Print Details"/>
                                                    </td>
                                                </tr>
                                            </form>
                                        </c:forEach>
                                        <div align="center">
                                            <form action="report_customers_all.jsp" method="POST" target="_blank">
                                                <%
                                                            List<Customers> A = (List) request.getAttribute("info");
                                                            session.setAttribute("listCus", A);
                                                %>

                                                <input type="submit" name="action" value="Print All Customers Details"/>
                                            </form>
                                        </div>
                                    </table>
                                </c:if>
                            </div>
                            <div align="center">
                                <form action="report_oderfood.jsp" method="POST" target="_blank" onsubmit="return check();">
                                    <h3 style="color: #7A0402">Order Report</h3>
                                    <table border="0">
                                        <tbody>
                                            <tr>
                                                <td>From Date:</td>
                                                <td><input type="text" name="date1" id="date1" readonly/></td>
                                            </tr>
                                            <tr>
                                                <td>To Date:</td>
                                                <td><input type="text" name="date2" id="date2" readonly/></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <input type="submit" name="action" value="ReportOrderFood"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div style="clear:left"></div>
                </div>
                <!--Bottom part-->
                <div id="bottom">
                    <div id="footer"><div class="fcenter">GROUP02-F5-10-1009-S1</div></div>
                </div>
            </div>
        </center>
    </body>
</html>
